package com.boge.ai.config;

import com.boge.ai.bean.MilvusEntity;
import io.milvus.client.MilvusServiceClient;
import io.milvus.param.ConnectParam;
import io.milvus.param.IndexType;
import io.milvus.param.MetricType;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.prompt.ChatOptions;
import org.springframework.ai.embedding.EmbeddingModel;
import org.springframework.ai.embedding.TokenCountBatchingStrategy;
import org.springframework.ai.openai.OpenAiChatModel;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.ai.vectorstore.VectorStore;
import org.springframework.ai.vectorstore.milvus.MilvusVectorStore;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ChatClientConfig {


    @Bean
    public ChatClient getChatClient(OpenAiChatModel model, ToolCallbackProvider callbackProvider) {
        return ChatClient.builder(model)
                .build();
    }


    @Bean
    public MilvusServiceClient getMilvusServiceClient(ChatClient client) {
        ConnectParam connectParam = ConnectParam.newBuilder()
                .withHost("localhost")
                .withPort(19530)
                .build();
        return new MilvusServiceClient(connectParam);
    }




//    @Bean
//    public ChatClient getChatClient(ChatClient.Builder builder) {
//        return builder.defaultOptions(ChatOptions.builder()
//                //.temperature(0.1)
//                        //.maxTokens(100)
//                        //.topK(5)
//                        //.topP(0.9)
//                .build())
//                //.defaultAdvisors(new SimpleLoggerAdvisor())
//                .build();
//    }



}
